/*
 * @Author: caijw 
 * @Date: 2018-10-22 23:32:30 
 * @Last Modified by: caijw
 * @Last Modified time: 2019-01-11 00:02:24
 */
import React from 'react';
import { Router, Route,Switch,Redirect } from 'react-router-dom'
import CreateHistory  from 'history/createHashHistory';
// import LazyHome from './container/home/Home';
// import LazyProfile from './container/profile/Profile';
import Bundle from "./components/Bundle";
import App from './container/app/App';

// 按需加载
let LazyHome =(props) => (<Bundle {...props} load={()=>import('./container/home/Home')}/>)


//页面编写
let LazyMessage =(props) => (<Bundle {...props} load={()=>import('./container/my/message/Message')}/>)
let LazyExchangeRecord =(props) => (<Bundle {...props} load={()=>import('./container/my/exchangeRecord/ExchangeRecord')}/>)
let LazyCollection =(props) => (<Bundle {...props} load={()=>import('./container/my/collection/Collection')}/>)
//浏览记录
let LazyBrowse =(props) => (<Bundle {...props} load={()=>import('./container/my/browse/Browse')}/>)
let LazyChangeAccount =(props) => (<Bundle {...props} load={()=>import('./container/my/personal/changeAccount/ChangeAccount')}/>)
let LazyChangeName =(props) => (<Bundle {...props} load={()=>import('./container/my/personal/changeName/ChangeName')}/>)
let LazyChangePassword =(props) => (<Bundle {...props} load={()=>import('./container/my/personal/changePassword/ChangePassword')}/>)
let LazyForgetPassword =(props) => (<Bundle {...props} load={()=>import('./container/my/personal/forgetPassword/ForgetPassword')}/>)

let lazyAccount =(props) => (<Bundle {...props} load={()=>import('./container/my/personal/money/Account')}/>)
let lazyMoney =(props) => (<Bundle {...props} load={()=>import('./container/my/personal/money/Money')}/>)

let lazyAddress =(props) => (<Bundle {...props} load={()=>import('./container/my/personal/address/Address')}/>)
let lazyEditAddress =(props) => (<Bundle {...props} load={()=>import('./container/my/personal/address/EditAddress')}/>)
let lazyAddressList =(props) => (<Bundle {...props} load={()=>import('./container/my/personal/address/AddressList')}/>)

//个人信息
let LazyPersonal =(props) => (<Bundle {...props} load={()=>import('./container/my/personal/personal/Personal')}/>)

//积分充值
let LazyRecharge =(props) => (<Bundle {...props} load={()=>import('./container/my/recharge/recharge/Recharge')}/>)
//积分兑换
let LazyRechargeRecord =(props) => (<Bundle {...props} load={()=>import('./container/my/recharge/rechargeRecord/RechargeRecord')}/>)
let lazyMy =(props) => (<Bundle {...props} load={()=>import('./container/my/My')}/>)

let lazyActivity =(props) => (<Bundle {...props} load={()=>import('./container/ambitus/activity/Activity')}/>)
let lazyActivityShare =(props) => (<Bundle {...props} load={()=>import('./container/ambitus/activity/ActivityShare')}/>)
let lazyRecruit =(props) => (<Bundle {...props} load={()=>import('./container/ambitus/activity/Recruit')}/>)
let lazyRecruitShare =(props) => (<Bundle {...props} load={()=>import('./container/ambitus/activity/RecruitShare')}/>)

let lazyAmbitusList =(props) => (<Bundle {...props} load={()=>import('./container/ambitus/list/list')}/>)
let lazyAmbitusDetail =(props) => (<Bundle {...props} load={()=>import('./container/ambitus/detail/detail')}/>)
let lazyAmbitusDetailShare =(props) => (<Bundle {...props} load={()=>import('./container/ambitus/detail/DetailShare')}/>)

//帮助与反馈 关于
let LazyHelp =(props) => (<Bundle {...props} load={()=>import('./container/my/help/Help')}/>)
let LazyAbout =(props) => (<Bundle {...props} load={()=>import('./container/my/help/About')}/>)

//提现
let LazyCash =(props) => (<Bundle {...props} load={()=>import('./container/my/cash/Cash')}/>)

// gao 页面编写
let gLogin =(props) => (<Bundle {...props} load={()=>import('./container/views/login/login')}/>)
let gRegister =(props) => (<Bundle {...props} load={()=>import('./container/views/login/register')}/>)
let gRegister2 =(props) => (<Bundle {...props} load={()=>import('./container/views/login/register2')}/>)
let gRegister3 =(props) => (<Bundle {...props} load={()=>import('./container/views/login/register3')}/>)
let gRegisterok =(props) => (<Bundle {...props} load={()=>import('./container/views/login/registerok')}/>)
let gHome =(props) => (<Bundle {...props} load={()=>import('./container/views/homePage/home')}/>)
let gDetail =(props) => (<Bundle {...props} load={()=>import('./container/views/homePage/detail')}/>)
let gDetailShare =(props) => (<Bundle {...props} load={()=>import('./container/views/homePage/ProductDetailShare')}/>)
let lottery =(props) => (<Bundle {...props} load={()=>import('./container/views/homePage/lottery')}/>)
let iframe =(props) => (<Bundle {...props} load={()=>import('./container/views/homePage/iframe')}/>)


let gCategoryList =(props) => (<Bundle {...props} load={()=>import('./container/views/category/cateList')}/>)
let gCategoryDetail =(props) => (<Bundle {...props} load={()=>import('./container/views/category/cateDetail')}/>)

let gCommunity =(props) => (<Bundle {...props} load={()=>import('./container/views/community/community')}/>)
let gFunDetail =(props) => (<Bundle {...props} load={()=>import('./container/views/community/funDetail')}/>)
let gEdit =(props) => (<Bundle {...props} load={()=>import('./container/views/community/edit')}/>)


let history = CreateHistory();
export default class Routes extends React.Component {
  render() {
    return (
      <Router history={history}>
        <App>
            <Switch>
                <Route path='/' exact={true} component={gHome}></Route>
                <Route path='/home' exact={true} component={gHome}></Route>
                <Route path='/category' component={gCategoryList}></Route>
                <Route path='/about' component={lazyAmbitusList}></Route> 

                <Route path='/aboutDetail/:id' component={lazyAmbitusDetail}></Route>
                <Route path='/aboutDetailShare/:id' component={lazyAmbitusDetailShare}></Route>              
                <Route path="/activity/:id" component={lazyActivity}></Route>
                <Route path="/activityShare/:id" component={lazyActivityShare}></Route>
                <Route path="/recruit/:id" component={lazyRecruit}></Route>
                <Route path="/recruitShare/:id" component={lazyRecruitShare}></Route>

                <Route path='/gDetailShare/:id' component={gDetailShare}></Route>

                <Route path='/community' component={gCommunity}></Route>

                <Route path='/my' component={lazyMy}></Route>
                <Route path='/account' component={lazyAccount}></Route>
                <Route path='/money' component={lazyMoney}></Route>
                <Route path="/recharge" component={LazyRecharge}></Route>
                <Route path="/rechargeRecord" component={LazyRechargeRecord}></Route>
                <Route path="/exchangeRecord" component={LazyExchangeRecord}></Route>
                <Route path="/browse" component={LazyBrowse}></Route>
                <Route path="/collection" component={LazyCollection}></Route>

                <Route path='/help' component={LazyHelp}></Route>
                <Route path='/aboutApp' component={LazyAbout}></Route>
                <Route path='/cash' component={lazyMoney}></Route>
                <Route path='/myMessage' component={LazyMessage}></Route>
                <Route path="/personal" component={LazyPersonal}></Route>
                <Route path="/changeName" component={LazyChangeName}></Route>
                <Route path="/address" component={lazyAddress}></Route>
                <Route path="/editAddress/:id/:cityId" component={lazyEditAddress}></Route>
                <Route path="/addressList" component={lazyAddressList}></Route>


                <Route path='/glogin' component={gLogin}></Route>
                <Route path='/register' component={gRegister}></Route>
                <Route path='/register2' component={gRegister2}></Route>
                <Route path='/register3' component={gRegister3}></Route>
                <Route path='/registerok' component={gRegisterok}></Route>
                <Route path='/categoryDetail' component={gCategoryDetail}></Route>
                <Route path='/gDetail/:id' component={gDetail}></Route>
                <Route path='/lottery' component={lottery}></Route> 
                <Route path='/iframe' component={iframe}></Route>
                <Route path='/funDetail' component={gFunDetail}></Route>
                <Route path='/edit' component={gEdit}></Route> 
                
                <Redirect to="/"></Redirect>
            </Switch>
        </App>
      </Router>
    )
  }
}
